import { reactive, ref } from 'vue'
import { VxeGridProps } from 'vxe-table'

interface Rows {
  idNo: string
  secretsName: string
  secretsType: string
  date: string
  inventor: string
  unit: string
  submitDate: string
}

const selectOptions = reactive([
  {
    label: '博士',
    value: '0',
  },
  {
    label: '硕士',
    value: '1',
  },
  {
    label: '学士',
    value: '2',
  },
])

const gridOptions = reactive<VxeGridProps<any>>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { field: 'id', title: 'ID' },
    { field: 'standardName', title: '标准名称' },
    { field: 'standardType', title: '标准类别' },
    { field: 'belongProfession', title: '归口专标委' },
    { field: 'draftUnitName', title: '起草单位' },
    { field: '', title: '项目负责人' },
    {
      field: 'createTime',
      title: '填报日期',
      formatter: ['formatDate', 'yyyy-MM-dd'],
    },
    { field: 'status', title: '状态' },
    {
      title: '操作',
      width: 200,
      slots: { default: 'operate' },
      fixed: 'right',
    },
  ],
  data: [
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
    },
  ],
})

const valueoptions = reactive([
  {
    label: '标准名称',
    value: 'standardName',
  },
  {
    label: '项目负责人',
    value: 'unit',
  },
  {
    label: '填报人',
    value: 'unit',
  },
])

const operationLog = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { field: 'type', title: '操作类型', width: 200 },
    { field: 'name', title: '操作员', width: 200 },
    { field: 'content', title: '操作内容' },
    { field: 'date', title: '操作时间', width: 200 },
  ],
  toolbarConfig: {
    slots: {
      buttons: 'toolbar_buttons',
    },
  },
  data: [
    {
      type: '修改状态',
      name: '曲丽丽',
      content: '修改了“软件名称”',
      date: '2023-01-01 00:00:00',
    },
    {
      type: '新增信息',
      name: '周毛毛',
      content: '新增软著信息',
      date: '2023-01-01 00:00:00',
    },
  ],
})

interface from {
  label: string
  prop: string
  type: string //select / date /tree
  options?: Array<{ label: string; value: string }>
}

const formList = ref<any>([
  {
    label: '状态：',
    prop: 'status',
    type: 'select',
    options: [],
  },
  {
    label: '标准类别：',
    prop: 'standardType',
    type: 'select',
    options: [],
  },
  {
    label: '归口专标委：',
    prop: 'belongProfession',
    type: 'select',
    options: [],
  },
  {
    label: '起草单位：',
    prop: 'draftUnitName',
    type: 'select',
    options: [],
  },
  {
    label: '填报日期：',
    prop: 'createTime',
    type: 'date',
  },
])

const tabFormList = ref([
  {
    label: '状态：',
    prop: 'a',
    type: 'select',
    options: [],
  },
  {
    label: '标准类别：',
    prop: 'b',
    type: 'select',
    options: [],
  },
  {
    label: '归口专标委：',
    prop: 'b',
    type: 'select',
    options: [],
  },
  {
    label: '起草单位',
    prop: 'c',
    type: 'select',
    options: [],
  },
  {
    label: '填报日期：',
    prop: 'c',
    type: 'date',
  },
  {
    label: '复审意见',
    prop: 'd',
    type: 'select',
    options: [],
  },
])

const tabGridOptions = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { field: 'id', title: '申请ID' },
    { field: 'standardName', title: '标准名称' },
    { field: 'standardId', title: '标准编号' },
    { field: 'standardType', title: '标准类别' },
    { field: 'belongProfession', title: '归口专标委' },
    { field: 'draftUnitName', title: '起草单位' },
    { field: 'unitName', title: '复审意见' },
    {
      field: 'createTime',
      title: '填报日期',
      formatter: ['formatDate', 'yyyy-MM-dd'],
    },
    { field: 'status', title: '状态' },
    {
      title: '操作',
      width: 200,
      slots: { default: 'operate' },
      fixed: 'right',
    },
  ],
  data: [
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
    },
  ],
})

const tabGridOptions4 = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { title: '序号', type: 'seq', width: 50 },
    { field: 'idNo', title: '申请ID' },
    { field: 'name', title: '标准名称' },
    { field: 'birthday', title: '标准编号' },
    { field: 'political', title: '标准类别' },
    { field: 'phone', title: '归口专标委' },
    { field: 'unitName', title: '起草单位' },
    {
      field: 'submitDate',
      title: '填报日期',
      formatter: ['formatDate', 'yyyy-MM-dd'],
    },
    { field: 'submitDate', title: '状态' },
    {
      title: '操作',
      width: 200,
      slots: { default: 'operate' },
      fixed: 'right',
    },
  ],
  data: [
    {
      idNo: 'xxx',
      name: 'xxxx',
      sex: '1',
      birthday: '2023-01-01 00:00:00',
      phone: '177xx',
      unitName: 'xxxxx',
      submitDate: 'xxx',
    },
  ],
})

const addFormList = ref<any>([
  {
    label: '标准名称：',
    prop: 'standardName',
    type: 'input',
  },
  {
    label: '标准类别：',
    prop: 'standardType',
    type: 'select',
    options: [],
  },
  {
    label: '归口专业：',
    prop: 'belongProfession',
    type: 'select',
    options: [],
  },
  {
    label: '起草单位：',
    prop: 'draftUnitId',
    type: 'select',
    options: [],
  },
  {
    label: '一、任务要点（目的、意义、主要工作内容及进度）',
    prop: 'taskPoints',
    type: 'textarea',
  },
  {
    label:
      '二、国内外情况简要说明（国内外生产技术状况，有哪些同类标准及主要数据，与同类标准的比较、说明）',
    prop: 'homeAbroadOverview',
    type: 'textarea',
  },
  {
    label: '三、标准起草主要内容（章、条目次）',
    prop: 'draftContent',
    type: 'textarea',
  },
  {
    label: '四、本标准预期达到的效果',
    prop: 'desiredResult',
    type: 'textarea',
  },
])

const addGridOptions = reactive<VxeGridProps<any>>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  editConfig: {},
  columns: [
    {
      field: 'patentName',
      title: '姓名',
      editRender: { autofocus: '.vxe-input--inner' },
      slots: { edit: 'patentName_edit' },
    },
    {
      field: 'patentPhone',
      title: '职称',
      editRender: { autofocus: '.vxe-input--inner' },
      slots: { edit: 'patentPhone_edit' },
    },
    {
      field: 'patentType',
      title: '工作单位',
      editRender: { autofocus: '.vxe-input--inner' },
      slots: { edit: 'patentType_edit' },
    },
    { title: '操作', width: 300, slots: { default: 'operate' } },
  ],
  data: [],
})
const initiateGridOptions = reactive({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  editConfig: {},
  columns: [
    { title: '序号', type: 'seq', width: 50 },
    {
      field: 'type',
      title: '类型',
      editRender: {},
      slots: { default: 'type_default', edit: 'type_edit' },
    },
    {
      field: 'content',
      title: '内容',
      editRender: {},
      slots: { default: 'content_default', edit: 'content_edit' },
    },
    { title: '操作', width: 300, slots: { default: 'operate' } },
  ],
  toolbarConfig: {},
  data: [
    {
      type: '1',
      content: '1',
    },
  ],
})

const initiateMeeting = ref([
  {
    label: '会议主题：',
    prop: 'a',
    type: 'input',
  },
  {
    label: '会议时间：',
    prop: 'b',
    type: 'date',
  },
  {
    label: '会议地点：',
    prop: 'c',
    type: 'input',
  },
  {
    label: '参会人：',
    prop: 'd',
    type: 'textarea',
  },
  {
    label: '会议描述',
    prop: 'e',
    type: 'textarea',
  },
  {
    label: '会议类型：',
    prop: 'f',
    type: 'select',
    disabled: true,
    options: [
      {
        label: '立项认证会',
        value: 1,
      },
      {
        label: '评审会议',
        value: 2,
      },
    ],
  },
])

export {
  gridOptions,
  operationLog,
  formList,
  valueoptions,
  tabFormList,
  tabGridOptions,
  tabGridOptions4,
  addFormList,
  addGridOptions,
  initiateMeeting,
  initiateGridOptions,
}
